Skip to content

[18.0][MIG] pos_payment_credit: Migration to 18.0#12

Open
P-H-Phuc wants to merge 8 commits into18.0from
18.0-mig-pos_payment_credit
Open

[18.0][MIG] pos_payment_credit: Migration to 18.0#12
P-H-Phuc wants to merge 8 commits into18.0from
18.0-mig-pos_payment_credit

Conversation

@P-H-Phuc
Copy link
Copy Markdown
Owner

@P-H-Phuc P-H-Phuc commented Jan 5, 2026

CONFIGURATION

  1. Go to Point of Sale > Configuration > Payment Methods
    In Payment Method form, create a new method and check a is credit as "Partner Credit Payment Method"

  2. Go to Point of Sale > Configuration > Settings

  • Select a PoS to use Partner Credit Payment Method
  • Add "Partner Credit Payment" to Payment methods in PoS
  • Check Automatically Apply Credit Amount
image
  1. Open register > Create a PoS Order > Select Customer > Select Partner Credit Payment to pay
image
  • Credit history in customer form
image

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_payment_credit branch 2 times, most recently from b4a1729 to 88e28de Compare January 6, 2026 07:56
@P-H-Phuc
Copy link
Copy Markdown
Owner Author

P-H-Phuc commented Jan 6, 2026

Dear anh @nguyenminhchien, please help me to review this PR

Copy link
Copy Markdown

@nguyenminhchien nguyenminhchien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error when making the payment by using Cash
image


{
"name": "Point of Sale Payment Credit",
"version": "18.0.1.0.1",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version": "18.0.1.0.1",
"version": "18.0.1.0.0",

<page string="Credit" name="page_credit">
<group name="payment_credit_amount">
<field name="credit_amount" />
<field name="credit_amount" readonly="0" />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why readonly="0"?

if (this.pos.paymentCreditInProgress && paymentMethod.is_credit) {
this.dialog.add(AlertDialog, {
title: _t("Error"),
body: _t("There is already an credit payment in progress."),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
body: _t("There is already an credit payment in progress."),
body: _t("There is already a credit payment in progress."),

class AccountJournal(models.Model):
_inherit = "account.journal"

is_credit = fields.Boolean(string="Allow to add credit for members")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to config from Journal anymore but Payment Method

class PosPaymentMethod(models.Model):
_inherit = "pos.payment.method"

is_credit = fields.Boolean(related="journal_id.is_credit")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is_credit = fields.Boolean(related="journal_id.is_credit")
is_credit = fields.Boolean()

@nguyenminhchien
Copy link
Copy Markdown

@P-H-Phuc
You should have a look at this feature in our staging instance first. Make sure it work as it's.

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="credit_journal" model="account.journal">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need data for account journal but for payment method.
all things must be in english, add french translation then.

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_payment_credit branch from 88e28de to 8b5d624 Compare February 4, 2026 09:46
Copy link
Copy Markdown

@nguyenminhchien nguyenminhchien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong message when paying refund order

Image

"successful": False,
"payload": {
"message": self.env._("Customer not found."),
"updated_credit_amount": partner.credit_amount,

This comment was marked as outdated.

if (paymentMethod.is_credit && !this.currentOrder.get_partner()) {
this.dialog.add(AlertDialog, {
title: _t("Please select the Customer"),
body: _t("You need to select a customer first."),

This comment was marked as resolved.

.reduce((sum, line) => sum + line.amount, 0);
const partner = this.currentOrder.get_partner();
if (partner) {
const {successful, payload} = await this.pos.data.call(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It breaks the offline-mode

Image

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_payment_credit branch from 8b5d624 to dd9de66 Compare February 6, 2026 08:01
Copy link
Copy Markdown

@nguyenminhchien nguyenminhchien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't allow paying by credit in offline-mode.

super.setup(...arguments);
this.pos.paymentCreditInProgress = false;
this.pos.paymentCreditText = "";
onMounted(() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-pos_payment_credit branch from dd9de66 to 3fa1603 Compare February 10, 2026 10:39
@P-H-Phuc
Copy link
Copy Markdown
Owner Author

@nguyenminhchienI have updated the code. In addition, I used a bus channel to automatically update the customer’s credit amount when an order is refunded on the Odoo backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants